Skip to content

fix(dde-dock/media): correct media playing state and tips text - #562

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-384813
Dec 1, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-384813

Conversation

@wjyrich

@wjyrich wjyrich commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor
  1. Use MediaModel playState as the single source of truth for playing()
  2. Emit mediaInfoChanged only when playback state actually changes
  3. Show "Not playing" instead of the track title when playback is idle
  4. Derive card tips text from player name, appending title only when playing
  5. Restrict subtitle text to active playback sessions

Log: Fix dock media state detection and tooltip text when idle Influence: Idle media playback now shows the player name instead of a stale track title.

fix(dde-dock/media): 修正媒体播放状态与提示文本

  1. playing() 统一以 MediaModel 播放状态为准
  2. 仅在播放状态实际变化时发出 mediaInfoChanged 信号
  3. 未播放时显示“Not playing”而非曲目名称
  4. 卡片提示文本以播放器名称为基础,仅在播放时追加标题
  5. 仅在播放中才显示副标题信息

Log: 修复任务栏媒体状态判断及空闲时的提示文本
Influence: 空闲状态下媒体提示将显示播放器名称而非过期曲目名。
PMS: BUG-384813

Summary by Sourcery

Correct idle media state text and keep track details limited to active playback.

Bug Fixes:

  • Show “Not playing” instead of stale track metadata when playback is idle, and use the player name as the tooltip text without an idle track title.

Enhancements:

  • Use the media model’s title and artist for track text, and show subtitle information only when playback is active.

Chores:

  • Add an unfinished translation entry for the “Not playing” label.

@sourcery-ai

sourcery-ai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

API

Expose trackTitle() on MediaController so callers can retrieve the current track title from the model.

  • plugins/dde-dock/media/mediacontroller.h L35

Implementation

Read track and artist text from MediaModel, use “Not playing” when no track title is available, and derive subtitle text from the model metadata.

  • plugins/dde-dock/media/mediacontroller.cpp L413-422, L428-430

UI

Build card tips from the player name and append the track title when available, and add the translation entry for the idle title text.

  • plugins/dde-dock/media/mediaplugin.cpp L176-179
  • plugins/dde-dock/translations/dde-dock.ts L135-138

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="plugins/dde-dock/media/mediacontroller.cpp" line_range="439" />
<code_context>
 QString MediaController::subtitleText() const
 {
-    if (m_mediaPlayer2) {
+    if (playing()) {
         const auto metadata = m_mediaPlayer2->metadata();
         const QString title = metadataText(metadata.value("xesam:title"));
</code_context>
<issue_to_address>
**Idle player name remains visible**

When playback is idle and the connected player has a nonempty app name, `subtitleText()` skips track metadata but falls through to `return m_appName`, and `MusicCard.qml` displays the nonempty subtitle, so the idle card still shows the player name.

Return an empty subtitle while playback is idle, including bypassing the `m_appName` fallback.

Also at `plugins/dde-dock/media/mediacontroller.cpp:440`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

QString MediaController::subtitleText() const
{
if (m_mediaPlayer2) {
if (playing()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Idle player name remains visible

When playback is idle and the connected player has a nonempty app name, subtitleText() skips track metadata but falls through to return m_appName, and MusicCard.qml displays the nonempty subtitle, so the idle card still shows the player name.

Return an empty subtitle while playback is idle, including bypassing the m_appName fallback.

Also at plugins/dde-dock/media/mediacontroller.cpp:440.

Prompt for AI agents
In `plugins/dde-dock/media/mediacontroller.cpp` at line 439:

**Idle player name remains visible**

When playback is idle and the connected player has a nonempty app name, `subtitleText()` skips track metadata but falls through to `return m_appName`, and `MusicCard.qml` displays the nonempty subtitle, so the idle card still shows the player name.

Return an empty subtitle while playback is idle, including bypassing the `m_appName` fallback.

Also at `plugins/dde-dock/media/mediacontroller.cpp:440`.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: BLumia, wjyrich

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1. Add trackTitle() to read title and artist from MediaModel instead of
MediaPlayer2 metadata
2. Rewrite titleText() to fall back to "Not playing" when no track info
is available
3. Update subtitleText() to compare artist and title from MediaModel
4. Adjust card tooltip to show "title - player" and handle empty player
gracefully
5. Add "Not playing" translation entry

Log: Use MediaModel as the single source for media title display
Influence: Media info in the dock stays consistent with playback state

fix(dde-dock/media): 统一媒体标题数据来源为 MediaModel

1. 新增 trackTitle(),从 MediaModel 读取歌名和艺术家而非 MediaPlayer2 元
数据
2. 重写 titleText(),无曲目信息时回退显示"未在播放"
3. 更新 subtitleText(),改为比较 MediaModel 中的艺术家与歌名
4. 调整卡片提示为"歌名 - 播放器",并处理播放器为空的情况
5. 新增"未在播放"翻译条目

Log: 以 MediaModel 作为媒体标题显示的唯一数据来源
Influence: 任务栏媒体信息与播放状态保持一致
PMS: BUG-384813
@wjyrich

wjyrich commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot
deepin-bot Bot merged commit 645bf4d into linuxdeepin:master Dec 1, 2026
9 of 13 checks passed
@deepin-bot

deepin-bot Bot commented Dec 1, 2026

Copy link
Copy Markdown

This pr force merged! (status: blocked, merge_method: rebase)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants